package registration;

import greenteam.mylook.R;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

public class Registration_Step_1 extends Fragment implements View.OnClickListener
{
    ImageView male_button, female_button;
    boolean choosed_gender = false;
    char gender;

	@Override
	public void onCreate(Bundle savedInstanceState) 
	{
		super.onCreate(savedInstanceState);
	}

	// onActivityCreated
	@Override
	public void onActivityCreated(Bundle savedInstanceState) 
	{
		super.onActivityCreated(savedInstanceState);
	}

	// onCreateView
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) 
	{
		View layoutView = inflater.inflate(R.layout.registration_step_1, container, false);

        male_button = (ImageView)layoutView.findViewById(R.id.male_button);
        male_button.setOnClickListener(this);
        female_button = (ImageView)layoutView.findViewById(R.id.female_button);
        female_button.setOnClickListener(this);

		return layoutView;
	}

    @Override
    public void onClick(View view)
    {
        switch (view.getId())
        {
            case R.id.male_button:
                male_button.setImageResource(R.drawable.male_colored);
                female_button.setImageResource(R.drawable.female_grayscale);
                gender = 'M';
                break;

            case R.id.female_button:
                female_button.setImageResource(R.drawable.female_colored);
                male_button.setImageResource(R.drawable.male_grayscale);
                gender = 'F';
                break;
        }

        choosed_gender = true;
    }

    public char getGender()
    {
        return gender;
    }

    public boolean StepOk()
    {
        return choosed_gender;
    }
}
